<template>
  <div class="vue-graph-node-wrapper" :class="selected ? 'selected' : ''">
    <div class="body"></div>
  </div>
</template>

<script>
export default {
  name: "vue-graph-node",
  inject: ["getGraph", "getNode"],
  data() {
    return {
      nodeData: this.getNode().getData(),
    };
  },
  computed: {
    selected() {
      return this.nodeData.selected;
    },
  },
};
</script>

<style lang="less">
.vue-graph-node-wrapper {
  width: 100%;
  height: 100%;
  // border: 2px solid #000;
  border: 1px solid #2c3539;
  border-radius: 6px;
  overflow: hidden;
  box-sizing: border-box;
  // background: linear-gradient(to bottom, #6fa8dc, #6fa8dc 20px, #444 20px);
  // background: linear-gradient(
  //   to bottom,
  //   #6fa8dc,
  //   #6fa8dc 20px,
  //   rgba(255, 255, 255, 0.5) 20px
  // );
  background-image: url("./vue-graph-node__bg.png");
  background-size: 100% 100%;
  // background-color: #444;

  display: flex;
  flex-direction: column;

  &.selected {
    border-color: rgb(154, 205, 50);
    box-shadow: 0 0 2px 2px rgba(154, 205, 50, 0.4);
  }

  .head {
    width: 100%;
    height: 20px;
    // background-color: #6fa8dc;
    color: white;
    line-height: 20px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
  }

  .body {
    width: 100%;
    flex: 1;
    // background-color: #444;
  }
}
</style>
